import request from '@/utils/request';
import { PageResponse } from '@/interface/pages';

/**
 * 获取分页列表
 *
 * @returns Promise
 *
 * @todo 发起axios请求
 */
export const getOrderList = (params: API.order.PageListDto) => {
  return request<PageResponse<API.order.EntitySchema[]>>({
    url: '/admin/order',
    method: 'get',
    params
  });
};

/**
 * 详情
 *
 * @param id
 * @returns Promise
 *
 * @todo 发起axios请求
 */
export const getOrderDetail = (ownId: string) => {
  return request({
    url: `/admin/order/${ownId}`,
    method: 'get'
  });
};

/**
 * 编辑
 *
 * @param id
 * @param data
 * @returns Promise
 *
 * @todo 发起axios请求
 */
export const updateOrder = (ownId: string, data: API.order.EntityDto) => {
  return request({
    url: `/admin/order/${ownId}`,
    method: 'put',
    data
  });
};
